TC65 has an embedded TCP/IP stack that is driven by AT commands and enables the host application to easily access the Internet. The advantage of this solution is that it eliminates the need for the application manufacturer to implement own TCP/IP and PPP stacks, thus minimizing cost and time to integrate Internet connectivity into a new or existing host application. This chapter is a reference guide to all the AT commands and responses defined for use with the TCP/IP stack.
Access is provided to the following Internet Services:
2.
3.
4.
5.
Two design strategies for using Internet Service AT commands - URC mode or polling mode:
The TC65 offers two modes of controlling an Internet session opened with AT^SISO. To select the mode that best suits the preferences of your application design use the AT^SCFG command, parameter "Tcp/WithURCs" (refer to <tcpWithUrc>).
• URC mode (delivery default):
The progress of an Internet session is URC driven. The URCs notify the host whether data can be sent or received, whether data transfer has completed, whether the service can be closed or whether an error has occurred. This mechanism eliminates the need to poll the service until the necessary progress information is received.
To enable the URC mode select: AT^SCFG="Tcp/WithURCs",on.
• Polling mode:
In polling mode, the presentation of URCs related to the Internet Services is disabled. The host is responsible to retrieve all the status information needed for controlling the Internet session. This is done by polling, where the host application keeps sending the commands AT^SISR, AT^SISW, AT^SISI.
To enable the polling mode select: AT^SCFG="Tcp/WithURCs",off.
The disabled URCs are the following: "^SISR" URC, "^SISW" URC and "^SIS" URC for parameter <urcCause>=0 (Internet service events), but not for <urcCause>=1 or 2 (needed for Socket listener and always enabled).
• First of all, create a CSD or GPRS connection profile with AT^SICS. The connection profile is a set of basic parameters which determines the type of connection to use for an Internet service. The connection type is also referred to as bearer. Up to 6 connection profiles can be defined, each identified by the <conProfileId>.
• Secondly, use AT^SISS to create a service profile based on one of the connection profiles. Up to 10 service profiles can be defined, each identified by the <srvProfileId>. The service profile specifies the type of Internet service to use, i.e. Socket, FTP, HTTP, or one of the email services SMTP or POP3. To assign a connection profile to a service profile, the <conProfileId> of AT^SICS must be entered as "conId" value of the AT^SISS parameter <srvParmTag>.
This offers great flexibility to combine connection profiles and service profiles. For example, you may have one connection profile (CSD or GPRS) specified with AT^SICS which can be associated with an SMTP service profile for sending emails and a POP3 service profile for retrieving emails.
• Once the connection profile and the service profile are created, an Internet session can be opened by entering the AT^SISO write command and the desired <srvProfileId>.
In URC mode, the "^SISR" or "^SISW" URC indicates whether the service is ready to receive or send data. This means, that the AT^SISR or AT^SISW command shall be entered after the URC was received. If an error occurs the "^SIS" URC is delivered instead.
In polling mode, you can enter the AT^SISR or AT^SISW command straight after AT^SISO though you may need to do so several times until the service confirms that data can be sent or received.
• The first parameter of the AT^SISR or AT^SISW commands is always the <srvProfileId>, the second parameter is the number of bytes which the host either wants to send to or is able to receive from the module. The way the module handles the data transfer follows the rules of the ordinary socket interface and is aware that a host may be limited by its input buffer size. The maximum data size supported by TC65 is 1500 bytes in both directions (read or write). To send or receive more than 1500 bytes, the read or write action shall be repeated until the data transfer has completed. Each read or write action requires that the command response (of AT^SISR or AT^SISW) confirms that the service is ready to send or receive data.
To end an upload data stream set the <eodFlag> in the last AT^SISW command.
• The AT^SISI command shall be used to monitor the progress of the session. The command reports the service state of the used service profile and indicates the number of bytes received, the number of bytes sent and, in the case of sending, the number of bytes acknowledged or unacknowledged at TCP layer.
• If an error occurs during a session you can enter the AT^SISE command and the <srvProfileId> to identify the reason. This is especially important in polling mode.
•
•
•
•
• Up to 10 service profiles can be created (with AT^SISS), but the number of parallel profiles of the same service type is limited as listed below. If the maximum number of a service profile type is already defined, any attempt to set up another profile for the same type will be denied with "+CME ERROR: operation of service temporary not allowed".
- Maximum 6 socket profiles: Only 2 instances can be opened for listener, meaning that if 2 listeners are established another 4 instances can be opened for clients. Also, the socket service can accept an incoming connection only when at least one service profile is still free (not yet created with AT^SISS), otherwise the incoming connection will be rejected from the listener. If there is no listener established all 6 socket profiles can be configured as client.
• The TCP/IP stack of TC65 supports using several service profiles at the same time, provided all of them are running on the same connection profile (bearer). For example, it is possible to download files from an FTP server, while sending and receiving emails at the same time.
Using Internet Service AT commands on several interfaces (ASC0, ASC1, USB or Multiplex mode on ASC0 or USB):
- Accordingly, on each interface the read commands AT^SISO? and AT^SISI? deliver full status information for the service profiles configured / opened on this interface, while service profiles related to other interfaces are only listed by <srvProfileId> and service type name (= <srvParmTag> value "srvType") without any status parameters.
- Changes to a service profile are allowed only on the same interface where it was created, trying to change it on another interface is denied with "+CME ERROR: Invalid index". If queried with the read command AT^SISS? the entire profile is returned on the interface where the service profile was created, while on all other interfaces only the service type of the profile is stated.
- To free a service profile for use on another interface, use the AT^SISS command and select service type = "none". This action deletes the entire profile and restores all parameters of the profile to their initial power-up state (all values are empty). For example, to remove the service profile 3, set AT^SISS=3,srvType,none. After this, a new profile 3 can be created on any other interface.
Address notation
Server addresses must be provided as IP addresses in standard dot-format (e.g. "192.168.1.2") or as server address names resolvable by a DNS server (e.g. "smtp.myserver.de" or "pop3.myserver.de").
Timeouts
Timeouts are not part of the Internet AT command functionality implemented in TC65 and, if desired, are the responsibility of the host application. It is recommended that the host application validates URCs and AT command responses and reacts adequately, for example by sending a close message or starting a timer.
Socket service used with UDP protocol
The significant differences between the TCP and UDP protocols imply that UDP sometimes requires particular procedures or even specific parameters. Details on how to handle UDP services can be found in extra notes or are included in the general parameter descriptions.
The TC65 offers two kinds of Socket service with UDP protocol. One is referred to as UDP client intended for connections to a given remote host. In this case the IP address and the UDP port of the remote host are set as a fixed parameter in the service profile. The other type is referred to as UDP endpoint where IP address and UDP port of the remote hosts are handled in each read (AT^SISR) and write (AT^SISW) request. This enables the host application to communicate with different remote hosts.
Using the DCD line to detect the connection status of Internet services
With AT&C you can configure the DCD line of the used serial interface to indicate whether an Internet service is active. For Socket, HTTP, SMTP and POP3 the states "Up" or "Connecting" are indicated, for FTP only the state "Up".
|